
<!DOCTYPE HTML>
<html lang="" >
    <head>
        <meta charset="UTF-8">
        <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
        <title>mysql性能测试 · tgor note</title>
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <meta name="description" content="">
        <meta name="generator" content="GitBook 3.2.3">
        <meta name="author" content="tgor">
        
        
    
    <link rel="stylesheet" href="../gitbook/style.css">

    
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-chapter-fold/chapter-fold.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-splitter/splitter.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-tbfed-pagefooter/footer.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-page-toc-button/plugin.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-search-pro/search.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-back-to-top-button/plugin.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-code/plugin.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-highlight/website.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-fontsettings/website.css">
                
            
        

    

    
        
    
        
    
        
    
        
    
        
    
        
    

        
    
    
    <meta name="HandheldFriendly" content="true"/>
    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <link rel="apple-touch-icon-precomposed" sizes="152x152" href="../gitbook/images/apple-touch-icon-precomposed-152.png">
    <link rel="shortcut icon" href="../gitbook/images/favicon.ico" type="image/x-icon">

    
    <link rel="next" href="mysql主从同步与读写分离.html" />
    
    
    <link rel="prev" href="mysql索引及查询.html" />
    

    </head>
    <body>
        
<div class="book">
    <div class="book-summary">
        
            
<div id="book-search-input" role="search">
    <input type="text" placeholder="Type to search" />
</div>

            
                <nav role="navigation">
                


<ul class="summary">
    
    

    

    
        
        
    
        <li class="chapter " data-level="1.1" data-path="../">
            
                <a href="../">
            
                    
                    Me
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2" data-path="../category/微服务.html">
            
                <a href="../category/微服务.html">
            
                    
                    微服务
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.2.1" data-path="../Java-Spring/Feign.html">
            
                <a href="../Java-Spring/Feign.html">
            
                    
                    HTTP客户端Feign
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.2" data-path="../Java-其他库/限流.html">
            
                <a href="../Java-其他库/限流.html">
            
                    
                    限流
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.3" data-path="../运维/Nginx限流.html">
            
                <a href="../运维/Nginx限流.html">
            
                    
                    限流Nginx
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.4" data-path="../Java-Spring/负载均衡.html">
            
                <a href="../Java-Spring/负载均衡.html">
            
                    
                    负载均衡
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.5" data-path="../运维/Nginx负载均衡.html">
            
                <a href="../运维/Nginx负载均衡.html">
            
                    
                    负载均衡Nginx
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.6" data-path="../Java-其他库/熔断Hystrix.html">
            
                <a href="../Java-其他库/熔断Hystrix.html">
            
                    
                    熔断Hystrix
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.7" data-path="../Java-其他库/缓存.html">
            
                <a href="../Java-其他库/缓存.html">
            
                    
                    缓存
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.8" data-path="../Java-其他库/缓存.html">
            
                <a href="../Java-其他库/缓存.html#本地缓存">
            
                    
                    本地缓存
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.9" data-path="../Redis/Redis.html">
            
                <a href="../Redis/Redis.html">
            
                    
                    分布式缓存Redis
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.10" data-path="../Java-其他库/分布式事务.html">
            
                <a href="../Java-其他库/分布式事务.html">
            
                    
                    分布式事务
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.11" data-path="../Java-其他库/分布式事务.html">
            
                <a href="../Java-其他库/分布式事务.html#事务消息">
            
                    
                    可靠事务消息
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.12" data-path="../Java-Spring/业务监控.html">
            
                <a href="../Java-Spring/业务监控.html">
            
                    
                    业务监控
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.13" data-path="../Java-其他库/分布式定时作业.html">
            
                <a href="../Java-其他库/分布式定时作业.html">
            
                    
                    分布式作业调度ElasticJob
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.14" data-path="../Java-ORM/ORM.html">
            
                <a href="../Java-ORM/ORM.html">
            
                    
                    ORM
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.15" data-path="../Java-其他库/分布式系统及CAP原理.html">
            
                <a href="../Java-其他库/分布式系统及CAP原理.html">
            
                    
                    分布式系统及CAP原理
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.16" data-path="../MQ/RabbitMQ笔记.html">
            
                <a href="../MQ/RabbitMQ笔记.html">
            
                    
                    消息驱动Rabbitmq
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.3" data-path="../category/数据库.html">
            
                <a href="../category/数据库.html">
            
                    
                    数据库
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.3.1" data-path="经典数据库设计案例.html">
            
                <a href="经典数据库设计案例.html">
            
                    
                    mysql设计
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.2" data-path="Mysql事务与锁.html">
            
                <a href="Mysql事务与锁.html">
            
                    
                    mysql事务与锁
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.3" data-path="mysql数据类型.html">
            
                <a href="mysql数据类型.html">
            
                    
                    mysql数据类型
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.4" data-path="mysql索引及查询.html">
            
                <a href="mysql索引及查询.html">
            
                    
                    mysql索引与查询
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.5" data-path="mysql索引及查询.html">
            
                <a href="mysql索引及查询.html#查询语句设计准则">
            
                    
                    mysql查询语句设计准则
            
                </a>
            

            
        </li>
    
        <li class="chapter active" data-level="1.3.6" data-path="mysql性能测试.html">
            
                <a href="mysql性能测试.html">
            
                    
                    mysql性能测试
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.7" data-path="mysql主从同步与读写分离.html">
            
                <a href="mysql主从同步与读写分离.html">
            
                    
                    mysql主从同步与读写分离
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.8" data-path="../Java-Spring/SpringBoot事务注解@Transactional.html">
            
                <a href="../Java-Spring/SpringBoot事务注解@Transactional.html">
            
                    
                    Spring事务注解@Transactional
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.9" data-path="../数据结构与算法/位运算应用实例.html">
            
                <a href="../数据结构与算法/位运算应用实例.html">
            
                    
                    位运算应用实例
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.10" data-path="../Mongodb-Client/morphia-API汇总.html">
            
                <a href="../Mongodb-Client/morphia-API汇总.html">
            
                    
                    morphia API汇总
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.11" data-path="../Mongodb-Client/mongo驱动连接.html">
            
                <a href="../Mongodb-Client/mongo驱动连接.html">
            
                    
                    mongodb驱动与连接
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.12" data-path="../Mongodb/mongodb-ObjectId实践.html">
            
                <a href="../Mongodb/mongodb-ObjectId实践.html">
            
                    
                    mongodb ObjectId实践
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.13" data-path="../Mongodb/mongodb角色权限.html">
            
                <a href="../Mongodb/mongodb角色权限.html">
            
                    
                    mongodb角色权限
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.4" data-path="../category/java并发.html">
            
                <a href="../category/java并发.html">
            
                    
                    Java并发
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.4.1" data-path="../Java-Base/Java并发.html">
            
                <a href="../Java-Base/Java并发.html">
            
                    
                    Java并发
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.2" data-path="../Java-Base/Java并发.html">
            
                <a href="../Java-Base/Java并发.html#锁">
            
                    
                    Java并发之锁设计
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.3" data-path="../Java-Base/Java并发.html">
            
                <a href="../Java-Base/Java并发.html#synchronized">
            
                    
                    Java并发之synchronized
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.4" data-path="../Java-Base/Java之Lock.html">
            
                <a href="../Java-Base/Java之Lock.html#reentrantlock">
            
                    
                    Java Lock之ReentrantLock
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.5" data-path="../Java-Base/Java之Lock.html">
            
                <a href="../Java-Base/Java之Lock.html#reentrantreadwritelock">
            
                    
                    Java Lock之ReentrantReadWriteLock
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.6" data-path="../Java-Base/Java之Future.html">
            
                <a href="../Java-Base/Java之Future.html">
            
                    
                    Java Future
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.7" data-path="../Java-Base/Java之Future.html">
            
                <a href="../Java-Base/Java之Future.html#futuretask">
            
                    
                    Java Future之FutureTask
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.8" data-path="../Java-Base/Java之Future.html">
            
                <a href="../Java-Base/Java之Future.html#completablefuture">
            
                    
                    Java Future之CompletableFuture
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.9" data-path="../Java-Base/Java之Future.html">
            
                <a href="../Java-Base/Java之Future.html#forkjointask">
            
                    
                    Java Future之ForkJoinTask
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.10" data-path="../Java-Base/Java之Thread.html">
            
                <a href="../Java-Base/Java之Thread.html">
            
                    
                    Java Thread
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.5" data-path="../category/redis.html">
            
                <a href="../category/redis.html">
            
                    
                    Redis
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.5.1" data-path="../Redis/Redis.html">
            
                <a href="../Redis/Redis.html">
            
                    
                    Redis
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.2" data-path="../Redis/Redis.html">
            
                <a href="../Redis/Redis.html#集群">
            
                    
                    Redis集群
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.3" data-path="../Redis/Redis.html">
            
                <a href="../Redis/Redis.html#消息订阅">
            
                    
                    Redis消息订阅
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.4" data-path="../Redis/Redis.html">
            
                <a href="../Redis/Redis.html#lua">
            
                    
                    Redis Lua脚本
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.5" data-path="../Redis/Redis.html">
            
                <a href="../Redis/Redis.html#配置汇总">
            
                    
                    Redis配置汇总
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.6" data-path="../category/运维.html">
            
                <a href="../category/运维.html">
            
                    
                    运维
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.6.1" data-path="../运维/Linux常用操作汇总.html">
            
                <a href="../运维/Linux常用操作汇总.html">
            
                    
                    Linux常用操作汇总
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.2" data-path="../运维/阿里云笔记.html">
            
                <a href="../运维/阿里云笔记.html">
            
                    
                    阿里云笔记
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.7" data-path="../category/nginx.html">
            
                <a href="../category/nginx.html">
            
                    
                    Nginx
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.7.1" data-path="../运维/Nginx学习笔记.html">
            
                <a href="../运维/Nginx学习笔记.html">
            
                    
                    Nginx基础
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.2" data-path="../运维/Nginx负载均衡.html">
            
                <a href="../运维/Nginx负载均衡.html">
            
                    
                    Nginx负载均衡
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.3" data-path="../运维/Nginx限流.html">
            
                <a href="../运维/Nginx限流.html">
            
                    
                    Nginx限流
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.4" data-path="../运维/Nginx学习笔记.html">
            
                <a href="../运维/Nginx学习笔记.html#六、其他">
            
                    
                    Nginx客户端辅助技巧
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.8" data-path="../category/容器化.html">
            
                <a href="../category/容器化.html">
            
                    
                    容器化
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.8.1" data-path="../Docker/docker笔记.html">
            
                <a href="../Docker/docker笔记.html">
            
                    
                    Docker学习笔记
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.8.2" data-path="../Docker/docker笔记.html">
            
                <a href="../Docker/docker笔记.html#基础操作">
            
                    
                    Docker基础操作
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.8.3" data-path="../Docker/docker笔记.html">
            
                <a href="../Docker/docker笔记.html#dockerfile">
            
                    
                    DockerFile
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.9" data-path="../category/Web.html">
            
                <a href="../category/Web.html">
            
                    
                    Web
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.9.1" data-path="../运维/Http入坑Https笔记.html">
            
                <a href="../运维/Http入坑Https笔记.html">
            
                    
                    Http入坑Https笔记
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.9.2" data-path="../Web/阿里云OSS.html">
            
                <a href="../Web/阿里云OSS.html">
            
                    
                    OSS
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.10" data-path="../category/java基础.html">
            
                <a href="../category/java基础.html">
            
                    
                    Java基础
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.10.1" data-path="../Java-Base/Java基础.html">
            
                <a href="../Java-Base/Java基础.html#jvm">
            
                    
                    JVM基础
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.10.2" data-path="../Java-Base/Java基础.html">
            
                <a href="../Java-Base/Java基础.html#语法糖">
            
                    
                    Java语法糖
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.10.3" data-path="../Java-Base/Java基础.html">
            
                <a href="../Java-Base/Java基础.html#数据结构">
            
                    
                    Java数据结构
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.10.4" data-path="../Java-Base/Java8函数式编程.html">
            
                <a href="../Java-Base/Java8函数式编程.html">
            
                    
                    java8函数式编程
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.10.5" data-path="../Java-Base/ArrayList源码分析.html">
            
                <a href="../Java-Base/ArrayList源码分析.html">
            
                    
                    JDK源码分析ArrayList
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.10.6" data-path="../Java-Base/HashMap源码分析.html">
            
                <a href="../Java-Base/HashMap源码分析.html">
            
                    
                    JDK源码分析HashMap
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.10.7" data-path="../Java-Base/Java注解.html">
            
                <a href="../Java-Base/Java注解.html">
            
                    
                    Java注解
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.10.8" data-path="../Java-Base/Timsort排序算法.html">
            
                <a href="../Java-Base/Timsort排序算法.html">
            
                    
                    Timsort排序算法
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.10.9" data-path="../Java-Base/插入排序分析与Java实现.html">
            
                <a href="../Java-Base/插入排序分析与Java实现.html">
            
                    
                    插入排序分析与Java实现
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.11" data-path="../category/工具与规范.html">
            
                <a href="../category/工具与规范.html">
            
                    
                    工具与规范
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.11.1" data-path="../工具/Maven使用技巧汇总.html">
            
                <a href="../工具/Maven使用技巧汇总.html">
            
                    
                    Maven使用技巧
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.11.2" data-path="../编码规范/Java编码规范.html">
            
                <a href="../编码规范/Java编码规范.html">
            
                    
                    Java编码规范
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.12" data-path="../category/OLAP.html">
            
                <a href="../category/OLAP.html">
            
                    
                    OLAP
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.12.1" data-path="../数据处理/storm学习笔记.html">
            
                <a href="../数据处理/storm学习笔记.html">
            
                    
                    流式计算Storm学习笔记
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.13" data-path="../category/数据运营.html">
            
                <a href="../category/数据运营.html">
            
                    
                    数据运营
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.13.1" data-path="../数据运营/增长黑客数据运营.html">
            
                <a href="../数据运营/增长黑客数据运营.html">
            
                    
                    增长黑客-数据运营
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.14" data-path="../category/前端技术栈.html">
            
                <a href="../category/前端技术栈.html">
            
                    
                    前端技术栈
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.14.1" data-path="../前端/JavaScript设计模式.html">
            
                <a href="../前端/JavaScript设计模式.html">
            
                    
                    JavaScript设计模式
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.14.2" data-path="../前端/html相对路径与绝对路径.html">
            
                <a href="../前端/html相对路径与绝对路径.html">
            
                    
                    Html相对路径与绝对路径
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.14.3" data-path="../前端/微信小程序学习笔记.html">
            
                <a href="../前端/微信小程序学习笔记.html">
            
                    
                    微信小程序学习笔记
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.15" data-path="../category/个人.html">
            
                <a href="../category/个人.html">
            
                    
                    个人
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.15.1" data-path="../个人/简历.html">
            
                <a href="../个人/简历.html">
            
                    
                    简历
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    

    

    <li class="divider"></li>

    <li>
        <a href="https://www.gitbook.com" target="blank" class="gitbook-link">
            Published with GitBook
        </a>
    </li>
</ul>


                </nav>
            
        
    </div>

    <div class="book-body">
        
            <div class="body-inner">
                
                    

<div class="book-header" role="navigation">
    

    <!-- Title -->
    <h1>
        <i class="fa fa-circle-o-notch fa-spin"></i>
        <a href=".." >mysql性能测试</a>
    </h1>
</div>




                    <div class="page-wrapper" tabindex="-1" role="main">
                        <div class="page-inner">
                            
<div id="book-search-results">
    <div class="search-noresults">
    
                                <section class="normal markdown-section">
                                
                                <h1 id="mysql&#x6027;&#x80FD;&#x6D4B;&#x8BD5;">Mysql&#x6027;&#x80FD;&#x6D4B;&#x8BD5;</h1>
<h1 id="sysbench&#x57FA;&#x51C6;&#x6D4B;&#x8BD5;&#x5DE5;&#x5177;">Sysbench&#x57FA;&#x51C6;&#x6D4B;&#x8BD5;&#x5DE5;&#x5177;</h1>
<p>&#x6D4B;&#x8BD5;&#x5DE5;&#x5177;&#xFF1A;sysbench</p>
<h2 id="&#x6D4B;&#x8BD5;&#x5185;&#x5BB9;">&#x6D4B;&#x8BD5;&#x5185;&#x5BB9;</h2>
<ul>
<li>CPU&#x6D4B;&#x8BD5;</li>
<li>&#x7EBF;&#x7A0B;&#x6D4B;&#x8BD5;</li>
<li>&#x78C1;&#x76D8;IO&#x6027;&#x80FD;&#x6D4B;&#x8BD5;</li>
<li>&#x5185;&#x5B58;&#x6D4B;&#x8BD5;</li>
<li>OLTP&#x6D4B;&#x8BD5;</li>
</ul>
<h2 id="&#x53C2;&#x6570;&#x8BE6;&#x89E3;">&#x53C2;&#x6570;&#x8BE6;&#x89E3;</h2>
<p>&#x542F;&#x52A8;&#x547D;&#x4EE4;&#x793A;&#x4F8B;</p>
<p>sysbench --test=./tests/db/oltp.lua --mysql-table-engine=innodb --oltp-table-size=100000 --mysql-user=root --mysql-password=root --mysql-host=localhost --mysql-db=sbtest --mysql-socket=/data/mysqldata/3306/mysql.sock prepare</p>
<p>sysbench --test=./tests/db/oltp.lua --mysql-table-engine=innodb --oltp-table-size=100000 --mysql-user=root --mysql-password=root --mysql-host=localhost --mysql-db=sbtest --mysql-socket=/data/mysqldata/3306/mysql.sock run</p>
<p>sysbench --test=./tests/db/oltp.lua --mysql-table-engine=innodb --oltp-table-size=100000 --mysql-user=root --mysql-password=root --mysql-host=localhost --mysql-db=sbtest --mysql-socket=/data/mysqldata/3306/mysql.sock cleanup</p>
<table>
<thead>
<tr>
<th>&#x53C2;&#x6570;</th>
<th>&#x8BF4;&#x660E;</th>
<th>&#x9ED8;&#x8BA4;</th>
<th>&#x793A;&#x4F8B;</th>
</tr>
</thead>
<tbody>
<tr>
<td>--test</td>
<td>&#x6D4B;&#x8BD5;lua&#x811A;&#x672C;</td>
<td></td>
<td><strong>test=./tests/db/oltp.lua</strong></td>
</tr>
<tr>
<td>oltp-tables-count</td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td>mysql-table-engine</td>
<td>mysql&#x5F15;&#x64CE;</td>
<td>innodb</td>
<td></td>
</tr>
<tr>
<td>oltp-table-size</td>
<td>&#x6BCF;&#x4E2A;&#x8868;&#x4EA7;&#x751F;&#x7684;&#x8BB0;&#x5F55;&#x884C;&#x6570;</td>
<td>10000000</td>
<td></td>
</tr>
<tr>
<td>mysql-user</td>
<td>&#x7528;&#x6237;&#x540D;</td>
<td></td>
<td></td>
</tr>
<tr>
<td>mysql-password</td>
<td>&#x5BC6;&#x7801;</td>
<td></td>
<td></td>
</tr>
<tr>
<td>mysql-host</td>
<td>host</td>
<td></td>
<td></td>
</tr>
<tr>
<td>mysql-port</td>
<td>&#x7AEF;&#x53E3;</td>
<td></td>
<td></td>
</tr>
<tr>
<td>mysql-db</td>
<td>&#x5E93;</td>
<td></td>
<td></td>
</tr>
<tr>
<td>rand-init</td>
<td>&#x662F;&#x5426;&#x968F;&#x673A;&#x521D;&#x59CB;&#x5316;&#x6570;&#x636E;</td>
<td></td>
<td>&#x5982;&#x4E0D;&#x968F;&#x673A;&#xFF0C;&#x5219;&#x6BCF;&#x884C;&#x5185;&#x5BB9;&#x9664;&#x4E3B;&#x952E;&#x5916;&#x5176;&#x4ED6;&#x5B8C;&#x5168;&#x76F8;&#x540C;</td>
</tr>
<tr>
<td>threads</td>
<td>&#x5BA2;&#x6237;&#x7AEF;&#x5E76;&#x53D1;&#x8FDE;&#x63A5;&#x6570;</td>
<td></td>
<td></td>
</tr>
<tr>
<td>events</td>
<td>&#x538B;&#x529B;&#x6D4B;&#x8BD5;&#x4EA7;&#x751F;&#x8BF7;&#x6C42;&#x7684;&#x603B;&#x6570;&#xFF0C;&#x4EE5;max-time&#x8BB0;&#x5F55;&#xFF0C;&#x5219;&#x4E3A;0</td>
<td>0</td>
<td></td>
</tr>
<tr>
<td>time</td>
<td>&#x6D4B;&#x8BD5;&#x7684;&#x6301;&#x7EED;&#x65F6;&#x95F4;&#xFF08;&#x5355;&#x4F4D;&#x79D2;&#xFF09;&#xFF08;&#x5FC5;&#x987B;&#xFF09;</td>
<td>120</td>
<td></td>
</tr>
<tr>
<td>--report-interval</td>
<td>&#x6BCF; 10s &#x8F93;&#x51FA;&#x4E00;&#x6B21;&#x6027;&#x80FD;&#x6570;&#x636E;</td>
<td>10</td>
<td></td>
</tr>
<tr>
<td>mysql_table_options</td>
<td>DRDS &#x652F;&#x6301;&#x62C6;&#x5206;&#x8868;&#xFF0C;&#x5728;&#x5EFA;&#x8868;&#x7684;&#x65F6;&#x5019;&#x9700;&#x8981;&#x6307;&#x5B9A;&#x62C6;&#x5206;&#x65B9;&#x5F0F;</td>
<td></td>
<td>&apos;dbpartition by hash(id) tbpartition by hash(id) tbpartitions 2&apos;</td>
</tr>
<tr>
<td><strong>--oltp-sp-name</strong></td>
<td>&#x5B58;&#x50A8;&#x8FC7;&#x7A0B;&#x540D;&#x79F0;</td>
<td>&#x7A7A;</td>
<td></td>
</tr>
<tr>
<td><strong>oltp-read-only</strong></td>
<td>&#x53EA;&#x8BFB;&#x6A21;&#x5F0F;&#xFF0C;update&#x3001;insert&#x7B49;&#x4E0D;&#x6267;&#x884C;</td>
<td>off</td>
<td>on / off</td>
</tr>
<tr>
<td><strong>oltp-table-name</strong></td>
<td>&#x6D4B;&#x8BD5;&#x4F7F;&#x7528;&#x7684;&#x8868;&#x540D;</td>
<td>sbtest</td>
<td></td>
</tr>
<tr>
<td><strong>oltp-table-size</strong></td>
<td>&#x6D4B;&#x8BD5;&#x8868;&#x7684;&#x8BB0;&#x5F55;&#x6570;</td>
<td>10000</td>
</tr>
</tbody>
</table>
<h2 id="&#x6D4B;&#x8BD5;&#x7ED3;&#x679C;&#x89E3;&#x8BFB;">&#x6D4B;&#x8BD5;&#x7ED3;&#x679C;&#x89E3;&#x8BFB;</h2>
<h1 id="&#x4E1A;&#x52A1;&#x573A;&#x666F;&#x6D4B;&#x8BD5;">&#x4E1A;&#x52A1;&#x573A;&#x666F;&#x6D4B;&#x8BD5;</h1>
<h2 id="&#x573A;&#x666F;&#xFF1A;&#x6263;&#x51CF;&#x5E93;&#x5B58;&#x589E;&#x52A0;&#x8BA2;&#x5355;">&#x573A;&#x666F;&#xFF1A;&#x6263;&#x51CF;&#x5E93;&#x5B58;&#x589E;&#x52A0;&#x8BA2;&#x5355;</h2>
<p>&#x6570;&#x636E;&#x8868;&#xFF1A;&#x8BA2;&#x5355;&#x8868;&#x3001;&#x5546;&#x54C1;&#x5E93;&#x5B58;&#x8868;</p>
<pre><code class="lang-sql"><span class="hljs-keyword">DROP</span> <span class="hljs-keyword">TABLE</span> <span class="hljs-keyword">IF</span> <span class="hljs-keyword">EXISTS</span> <span class="hljs-string">`product`</span>;

<span class="hljs-keyword">CREATE</span> <span class="hljs-keyword">TABLE</span> <span class="hljs-string">`product`</span> (
  <span class="hljs-string">`id`</span> <span class="hljs-built_in">int</span>(<span class="hljs-number">11</span>) <span class="hljs-keyword">unsigned</span> <span class="hljs-keyword">NOT</span> <span class="hljs-literal">NULL</span> AUTO_INCREMENT,
  <span class="hljs-string">`title`</span> <span class="hljs-built_in">varchar</span>(<span class="hljs-number">100</span>) <span class="hljs-keyword">NOT</span> <span class="hljs-literal">NULL</span> <span class="hljs-keyword">DEFAULT</span> <span class="hljs-string">&apos;&apos;</span> <span class="hljs-keyword">COMMENT</span> <span class="hljs-string">&apos;&#x5546;&#x54C1;&#x540D;&#x79F0;&apos;</span>,
  <span class="hljs-string">`store`</span> <span class="hljs-built_in">int</span>(<span class="hljs-number">11</span>) <span class="hljs-keyword">unsigned</span> <span class="hljs-keyword">NOT</span> <span class="hljs-literal">NULL</span> <span class="hljs-keyword">DEFAULT</span> <span class="hljs-number">0</span> <span class="hljs-keyword">COMMENT</span> <span class="hljs-string">&apos;&#x5E93;&#x5B58;&apos;</span>,
  <span class="hljs-string">`created`</span> datetime <span class="hljs-keyword">NOT</span> <span class="hljs-literal">NULL</span>,
  PRIMARY <span class="hljs-keyword">KEY</span> (<span class="hljs-string">`id`</span>)
) <span class="hljs-keyword">ENGINE</span>=<span class="hljs-keyword">InnoDB</span> <span class="hljs-keyword">DEFAULT</span> <span class="hljs-keyword">CHARSET</span>=utf8mb4 <span class="hljs-keyword">COMMENT</span>=<span class="hljs-string">&apos;&#x5546;&#x54C1;&#x5E93;&#x5B58;&#x8868;&apos;</span>;

<span class="hljs-keyword">DROP</span> <span class="hljs-keyword">TABLE</span> <span class="hljs-keyword">IF</span> <span class="hljs-keyword">EXISTS</span> <span class="hljs-string">`product_order`</span>;

<span class="hljs-keyword">CREATE</span> <span class="hljs-keyword">TABLE</span> <span class="hljs-string">`product_order`</span> (
  <span class="hljs-string">`id`</span> <span class="hljs-built_in">int</span>(<span class="hljs-number">11</span>) <span class="hljs-keyword">unsigned</span> <span class="hljs-keyword">NOT</span> <span class="hljs-literal">NULL</span> AUTO_INCREMENT,
  <span class="hljs-string">`product_id`</span> <span class="hljs-built_in">int</span>(<span class="hljs-number">11</span>) <span class="hljs-keyword">unsigned</span> <span class="hljs-keyword">NOT</span> <span class="hljs-literal">NULL</span> <span class="hljs-keyword">DEFAULT</span> <span class="hljs-number">0</span> <span class="hljs-keyword">COMMENT</span> <span class="hljs-string">&apos;&#x5546;&#x54C1;Id&apos;</span>,
  <span class="hljs-string">`user_id`</span> <span class="hljs-built_in">int</span>(<span class="hljs-number">11</span>) <span class="hljs-keyword">unsigned</span> <span class="hljs-keyword">NOT</span> <span class="hljs-literal">NULL</span> <span class="hljs-keyword">DEFAULT</span> <span class="hljs-number">0</span> <span class="hljs-keyword">COMMENT</span> <span class="hljs-string">&apos;&#x7528;&#x6237;Id&apos;</span>,
  <span class="hljs-string">`created`</span> datetime <span class="hljs-keyword">NOT</span> <span class="hljs-literal">NULL</span>,
  PRIMARY <span class="hljs-keyword">KEY</span> (<span class="hljs-string">`id`</span>),
  <span class="hljs-keyword">KEY</span> <span class="hljs-string">`user_id_product_id`</span> (<span class="hljs-string">`user_id`</span>, <span class="hljs-string">`product_id`</span>)
) <span class="hljs-keyword">ENGINE</span>=<span class="hljs-keyword">InnoDB</span> AUTO_INCREMENT=<span class="hljs-number">1</span> <span class="hljs-keyword">DEFAULT</span> <span class="hljs-keyword">CHARSET</span>=utf8mb4 <span class="hljs-keyword">COMMENT</span>=<span class="hljs-string">&apos;&#x5546;&#x54C1;&#x5E93;&#x5B58;&#x8868;&apos;</span>;
</code></pre>
<p>&#x6570;&#x636E;&#x89C4;&#x6A21;</p>
<ul>
<li>&#x5546;&#x54C1;&#x5E93;&#x5B58;&#x8868;&#xFF1A;100w&#x8BB0;&#x5F55;&#xFF0C;&#x5E93;&#x5B58;10w&#xFF08;&#x8DB3;&#x591F;&#x5E93;&#x5B58;&#xFF09;</li>
<li>&#x8BA2;&#x5355;&#x8868;&#xFF1A;1kw&#x5F20;&#x8BA2;&#x5355;</li>
</ul>
<h3 id="sql&#x811A;&#x672C;">Sql&#x811A;&#x672C;</h3>
<pre><code class="lang-sql"><span class="hljs-comment">--&#x573A;&#x666F;1&#xFF1A;&#x9884;&#x5904;&#x7406;&#xFF0C;&#x589E;&#x52A0;&#x5546;&#x54C1;</span>
<span class="hljs-keyword">insert</span> <span class="hljs-keyword">into</span> <span class="hljs-string">`product`</span> (title, <span class="hljs-keyword">store</span>, created) <span class="hljs-keyword">values</span> (?, <span class="hljs-number">100000</span>, <span class="hljs-keyword">now</span>());

<span class="hljs-comment">--&#x573A;&#x666F;2&#xFF1A;&#x6263;&#x51CF;&#x5E93;&#x5B58;&#x589E;&#x52A0;&#x8BA2;&#x5355;</span>
<span class="hljs-keyword">update</span> <span class="hljs-string">`product`</span> <span class="hljs-keyword">set</span> <span class="hljs-string">`store`</span>=<span class="hljs-string">`store`</span><span class="hljs-number">-1</span> <span class="hljs-keyword">where</span> <span class="hljs-keyword">id</span> =?

<span class="hljs-keyword">select</span> <span class="hljs-string">`store`</span> <span class="hljs-keyword">from</span> <span class="hljs-string">`product`</span> <span class="hljs-keyword">where</span> <span class="hljs-keyword">id</span> = ?

<span class="hljs-keyword">insert</span> <span class="hljs-keyword">into</span> <span class="hljs-string">`product_order`</span> (product_id, user_id, created) <span class="hljs-keyword">values</span> (?, ?, <span class="hljs-keyword">now</span>());
</code></pre>
<h3 id="lua&#x811A;&#x672C;">Lua&#x811A;&#x672C;</h3>
<p>&#x9884;&#x5904;&#x7406;prepare lua</p>
<pre><code class="lang-lua">pathtest = <span class="hljs-built_in">string</span>.match(test, <span class="hljs-string">&quot;(.*/)&quot;</span>) <span class="hljs-keyword">or</span> <span class="hljs-string">&quot;&quot;</span>

<span class="hljs-built_in">dofile</span>(pathtest .. <span class="hljs-string">&quot;common.lua&quot;</span>)

<span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">thread_init</span><span class="hljs-params">(thread_id)</span></span>
   set_vars()

   <span class="hljs-keyword">if</span> (((db_driver == <span class="hljs-string">&quot;mysql&quot;</span>) <span class="hljs-keyword">or</span> (db_driver == <span class="hljs-string">&quot;attachsql&quot;</span>)) <span class="hljs-keyword">and</span> mysql_table_engine == <span class="hljs-string">&quot;myisam&quot;</span>) <span class="hljs-keyword">then</span>
      begin_query = <span class="hljs-string">&quot;LOCK TABLES sbtest WRITE&quot;</span>
      commit_query = <span class="hljs-string">&quot;UNLOCK TABLES&quot;</span>
   <span class="hljs-keyword">else</span>
      begin_query = <span class="hljs-string">&quot;BEGIN&quot;</span>
      commit_query = <span class="hljs-string">&quot;COMMIT&quot;</span>
   <span class="hljs-keyword">end</span>

<span class="hljs-keyword">end</span>

<span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">event</span><span class="hljs-params">(thread_id)</span></span>
   <span class="hljs-keyword">local</span> rs
   <span class="hljs-keyword">local</span> table_name_product = <span class="hljs-string">&quot;product&quot;</span>
   <span class="hljs-comment">--&#x5546;&#x54C1;10w</span>
   <span class="hljs-keyword">local</span> product_count = <span class="hljs-number">100000</span>
   <span class="hljs-comment">--&#x968F;&#x673A;&#x5546;&#x54C1;&#x6807;&#x9898;</span>
   <span class="hljs-keyword">local</span> title = sb_rand_str(<span class="hljs-string">&quot;###############-##############&quot;</span>)

   <span class="hljs-comment">--&#x5982;&#x679C;&#x6CA1;&#x6709;&#x5F00;&#x542F;&#x8DF3;&#x8FC7;&#x4E8B;&#x52A1;&#xFF0C;&#x90A3;&#x4E48;&#x5C31;&#x628A;&#x6240;&#x6709;&#x7684;sql&#x653E;&#x5728;&#x4E00;&#x4E2A;&#x4E8B;&#x52A1;&#x91CC;&#x9762;</span>
   <span class="hljs-keyword">if</span> <span class="hljs-keyword">not</span> oltp_skip_trx <span class="hljs-keyword">then</span>
      db_query(begin_query)
   <span class="hljs-keyword">end</span>  

   <span class="hljs-comment">--insert&#x64CD;&#x4F5C;</span>
   rs = db_query(<span class="hljs-string">&quot;INSERT INTO &quot;</span> .. table_name_product ..  <span class="hljs-string">&quot; (title, store, created) VALUES &quot;</span> .. <span class="hljs-built_in">string</span>.format(<span class="hljs-string">&quot;(&apos;%s&apos;, %d, now())&quot;</span>, title, product_count ))

   <span class="hljs-keyword">if</span> <span class="hljs-keyword">not</span> oltp_skip_trx <span class="hljs-keyword">then</span>
      db_query(commit_query)
   <span class="hljs-keyword">end</span>

<span class="hljs-keyword">end</span>
</code></pre>
<p>&#x589E;&#x52A0;&#x8BA2;&#x5355;run lua</p>
<pre><code class="lang-lua">pathtest = <span class="hljs-built_in">string</span>.match(test, <span class="hljs-string">&quot;(.*/)&quot;</span>) <span class="hljs-keyword">or</span> <span class="hljs-string">&quot;&quot;</span>

<span class="hljs-built_in">dofile</span>(pathtest .. <span class="hljs-string">&quot;common.lua&quot;</span>)

<span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">thread_init</span><span class="hljs-params">(thread_id)</span></span>
   set_vars()

   <span class="hljs-keyword">if</span> (((db_driver == <span class="hljs-string">&quot;mysql&quot;</span>) <span class="hljs-keyword">or</span> (db_driver == <span class="hljs-string">&quot;attachsql&quot;</span>)) <span class="hljs-keyword">and</span> mysql_table_engine == <span class="hljs-string">&quot;myisam&quot;</span>) <span class="hljs-keyword">then</span>
      begin_query = <span class="hljs-string">&quot;LOCK TABLES sbtest WRITE&quot;</span>
      commit_query = <span class="hljs-string">&quot;UNLOCK TABLES&quot;</span>
   <span class="hljs-keyword">else</span>
      begin_query = <span class="hljs-string">&quot;BEGIN&quot;</span>
      commit_query = <span class="hljs-string">&quot;COMMIT&quot;</span>
   <span class="hljs-keyword">end</span>

<span class="hljs-keyword">end</span>

<span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">event</span><span class="hljs-params">(thread_id)</span></span>
   <span class="hljs-keyword">local</span> rs
   <span class="hljs-keyword">local</span> table_name_product = <span class="hljs-string">&quot;product&quot;</span>
   <span class="hljs-keyword">local</span> table_name_order = <span class="hljs-string">&quot;product_order&quot;</span>
   <span class="hljs-comment">--&#x5546;&#x54C1;10w</span>
   <span class="hljs-keyword">local</span> product_count = <span class="hljs-number">100000</span>
   <span class="hljs-comment">--&#x7528;&#x6237;100w</span>
   <span class="hljs-keyword">local</span> user_count = <span class="hljs-number">1000000</span>
   <span class="hljs-comment">--&#x968F;&#x673A;&#x5546;&#x54C1;Id</span>
   <span class="hljs-keyword">local</span> target_product_id = sb_rand(<span class="hljs-number">1</span>, product_count)

   <span class="hljs-comment">--&#x5982;&#x679C;&#x6CA1;&#x6709;&#x5F00;&#x542F;&#x8DF3;&#x8FC7;&#x4E8B;&#x52A1;&#xFF0C;&#x90A3;&#x4E48;&#x5C31;&#x628A;&#x6240;&#x6709;&#x7684;sql&#x653E;&#x5728;&#x4E00;&#x4E2A;&#x4E8B;&#x52A1;&#x91CC;&#x9762;</span>
   <span class="hljs-keyword">if</span> <span class="hljs-keyword">not</span> oltp_skip_trx <span class="hljs-keyword">then</span>
      db_query(begin_query)
   <span class="hljs-keyword">end</span>

   <span class="hljs-comment">--update&#x64CD;&#x4F5C;&#xFF0C;&#x7B80;&#x5355;&#x7684;update</span>
   rs = db_query(<span class="hljs-string">&quot;UPDATE &quot;</span> .. table_name_product .. <span class="hljs-string">&quot; SET `store`=`store`-1 WHERE id=&quot;</span> .. target_product_id)

   <span class="hljs-comment">--&#x67E5;&#x8BE2;&#x5E93;&#x5B58;</span>
   rs = db_query(<span class="hljs-string">&quot;select `store` from `product` where id =&quot;</span> .. c_id)

   <span class="hljs-comment">--insert&#x64CD;&#x4F5C;</span>
   rs = db_query(<span class="hljs-string">&quot;INSERT INTO &quot;</span> .. table_name_order ..  <span class="hljs-string">&quot; (product_id, user_id, created) VALUES &quot;</span> .. <span class="hljs-built_in">string</span>.format(<span class="hljs-string">&quot;(%d, %d, now())&quot;</span>, target_product_id, sb_rand(<span class="hljs-number">1</span>, user_count) ))

   <span class="hljs-keyword">if</span> <span class="hljs-keyword">not</span> oltp_skip_trx <span class="hljs-keyword">then</span>
      db_query(commit_query)
   <span class="hljs-keyword">end</span>

<span class="hljs-keyword">end</span>
</code></pre>
<h3 id="&#x6D4B;&#x8BD5;&#x73AF;&#x5883;">&#x6D4B;&#x8BD5;&#x73AF;&#x5883;</h3>
<ul>
<li>&#x786C;&#x4EF6;&#xFF1A;Nas Intel&#xAE; Celeron&#xAE; J3455 &#x56DB;&#x6838; 1.5 GHz </li>
<li>&#x5BB9;&#x5668;Sysbench&#xFF1A;&#x7248;&#x672C;1.0.17&#xFF0C;&#x5206;&#x914D;4G&#x5185;&#x5B58;</li>
<li>&#x5BB9;&#x5668;mysql&#xFF1A;&#x7248;&#x672C;5.7.26&#xFF0C;&#x5206;&#x914D;8G&#x5185;&#x5B58;&#xFF0C;Innodb&#xFF0C;&#x6700;&#x5927;&#x8FDE;&#x63A5;&#x6570;151</li>
</ul>
<h3 id="docker&#x4E0E;sysbench&#x547D;&#x4EE4;">Docker&#x4E0E;Sysbench&#x547D;&#x4EE4;</h3>
<pre><code class="lang-powershell"><span class="hljs-comment">#docker&#x547D;&#x4EE4;&#xFF0C;&#x6302;&#x8F7D;&#x5230;&#x5171;&#x4EAB;&#x76EE;&#x5F55;</span>
docker run -i -t --name sysbench4 -v /share/CACHEDEV1_DATA/Container/mysql/test:/lua -d severalnines/sysbench

<span class="hljs-comment">#&#x6279;&#x91CF;&#x5199;&#x5165;&#x5546;&#x54C1;</span>
sysbench --oltp_tables_count=<span class="hljs-number">1</span> --report-interval=<span class="hljs-number">10</span> --oltp-table-size=<span class="hljs-number">1000000</span>  --mysql-user=root --mysql-password=<span class="hljs-number">504</span> --mysql-table-engine=innodb  --rand-init=on  --mysql-host=<span class="hljs-number">192.168</span>.<span class="hljs-number">1.119</span> --mysql-port=<span class="hljs-number">33069</span> --mysql-db=test --events=<span class="hljs-number">1000000</span> --oltp_skip_trx=off --oltp_auto_inc=on --threads=<span class="hljs-number">150</span> --time=<span class="hljs-number">600</span> --debug /lua/create_product.lua run &gt;&gt; /lua/create.log

<span class="hljs-comment">#&#x4E0B;&#x8BA2;&#x5355;</span>
sysbench --oltp_tables_count=<span class="hljs-number">1</span> --report-interval=<span class="hljs-number">10</span> --oltp-table-size=<span class="hljs-number">1000000</span>  --mysql-user=root --mysql-password=<span class="hljs-number">504</span> --mysql-table-engine=innodb  --rand-init=on  --mysql-host=<span class="hljs-number">10.0</span>.<span class="hljs-number">5.1</span> --mysql-port=<span class="hljs-number">33069</span> --mysql-db=test --events=<span class="hljs-number">1000000</span> --oltp_skip_trx=off --oltp_auto_inc=on --threads=<span class="hljs-number">150</span> --time=<span class="hljs-number">600</span> /lua/order.lua run &gt;&gt; order.log
</code></pre>
<p>&#x4E3B;&#x8981;&#x4E8B;&#x9879;</p>
<p>1&#x3001;&#x9700;&#x8981;&#x5C06;&#x81EA;&#x5B9A;&#x4E49;lua&#x4E2D;&#x5F15;&#x7528;&#x7684;common.lua&#x62F7;&#x8D1D;&#x5230;&#x76EE;&#x5F55;usr&#x5185;&#xFF0C;&#x5426;&#x5219;lua&#x8FD0;&#x884C;&#x4F1A;&#x62A5;&#x9519;</p>
<pre><code class="lang-lua">pathtest = <span class="hljs-built_in">string</span>.match(test, <span class="hljs-string">&quot;(.*/)&quot;</span>) <span class="hljs-keyword">or</span> <span class="hljs-string">&quot;&quot;</span>

<span class="hljs-built_in">dofile</span>(pathtest .. <span class="hljs-string">&quot;common.lua&quot;</span>)
</code></pre>
<p>queb</p>
<p><img src="assets/1585620926329.png" alt="1585620926329"></p>
<p>2&#x3001;Docker&#x5BB9;&#x5668;&#x95F4;&#x4E92;&#x8FDE;&#xFF0C;&#x9700;&#x8981;&#x83B7;&#x5F97;docker0 ip</p>
<p><img src="assets/1585628284951.png" alt="1585628284951"></p>
<h3 id="&#x5199;&#x5165;&#x4E8B;&#x52A1;&#x7EA7;&#x522B;&#x5BF9;&#x6BD4;">&#x5199;&#x5165;&#x4E8B;&#x52A1;&#x7EA7;&#x522B;&#x5BF9;&#x6BD4;</h3>
<p>RR vs RC</p>
<p>RR&#x81EA;&#x589E;&#x4E3B;&#x952E;</p>
<table>
<thead>
<tr>
<th>&#x573A;&#x666F;</th>
<th>TPS</th>
<th>QPS</th>
<th>&#x4E3B;&#x952E;&#x7C7B;&#x578B;</th>
<th>&#x4E8B;&#x52A1;&#x7EA7;&#x522B;</th>
<th>&#x73B0;&#x5B58;&#x6570;&#x636E;&#x91CF;</th>
<th>&#x5199;&#x5165;&#x6570;&#x636E;&#x91CF;</th>
<th>sb&#x6267;&#x884C;&#x65F6;&#x95F4;</th>
<th>&#x6700;&#x5927;&#x8FDE;&#x63A5;&#x6570;</th>
<th>sb&#x5E76;&#x53D1;&#x7EBF;&#x7A0B;&#x6570;</th>
</tr>
</thead>
<tbody>
<tr>
<td>1</td>
<td>2877</td>
<td>8633</td>
<td>id&#x81EA;&#x589E;</td>
<td>RR</td>
<td>1&#x767E;&#x4E07;</td>
<td>1&#x767E;&#x4E07;</td>
<td>347s</td>
<td>151</td>
<td>150</td>
</tr>
<tr>
<td>2</td>
<td>2986</td>
<td>8960</td>
<td>id&#x81EA;&#x589E;</td>
<td>RC</td>
<td>1&#x767E;&#x4E07;</td>
<td>1&#x767E;&#x4E07;</td>
<td>334s</td>
<td>151</td>
<td>150</td>
</tr>
<tr>
<td></td>
<td></td>
<td></td>
<td>id&#x81EA;&#x589E;</td>
<td>RC</td>
<td>2&#x767E;&#x4E07;</td>
<td>1&#x5343;&#x4E07;</td>
<td></td>
<td>1000</td>
<td>980</td>
</tr>
<tr>
<td>3</td>
<td>2627</td>
<td>7881</td>
<td>id&#x81EA;&#x589E;</td>
<td>RR</td>
<td>1&#x5343;&#x4E07;</td>
<td>1&#x767E;&#x4E07;</td>
<td>380</td>
<td>151</td>
<td>150</td>
</tr>
<tr>
<td>4</td>
<td></td>
<td></td>
<td>id&#x81EA;&#x589E;</td>
<td>RC</td>
<td>1&#x5343;&#x4E07;</td>
<td>1&#x767E;&#x4E07;</td>
<td></td>
<td></td>
</tr>
</tbody>
</table>
<p>&#x573A;&#x666F;1</p>
<pre><code>&#x547D;&#x4EE4;
sysbench --oltp_tables_count=1 --report-interval=10 --oltp-table-size=1000000  --mysql-user=root --mysql-password=504 --mysql-table-engine=innodb  --rand-init=on  --mysql-host=10.0.5.1 --mysql-port=33069 --mysql-db=test --events=1000000 --oltp_skip_trx=off --oltp_auto_inc=on --threads=150 --time=600 --debug /lua/create_product.lua run &gt;&gt; /lua/create.log


SQL statistics:
    queries performed:
        read:                            0
        write:                           1000000
        other:                           2000000
        total:                           3000000
    transactions:                        1000000 (2877.86 per sec.)
    queries:                             3000000 (8633.58 per sec.)
    ignored errors:                      0      (0.00 per sec.)
    reconnects:                          0      (0.00 per sec.)

General statistics:
    total time:                          347.4788s
    total number of events:              1000000

Latency (ms):
         min:                                    3.97
         avg:                                   52.11
         max:                                 1252.47
         95th percentile:                      110.66
         sum:                             52113139.04

Threads fairness:
    events (avg/stddev):           6666.6667/31.55
    execution time (avg/stddev):   347.4209/0.01
</code></pre><p>&#x573A;&#x666F;2</p>
<pre><code>SQL statistics:
    queries performed:
        read:                            0
        write:                           1000000
        other:                           2000000
        total:                           3000000
    transactions:                        1000000 (2986.98 per sec.)
    queries:                             3000000 (8960.93 per sec.)
    ignored errors:                      0      (0.00 per sec.)
    reconnects:                          0      (0.00 per sec.)

General statistics:
    total time:                          334.7851s
    total number of events:              1000000

Latency (ms):
         min:                                    3.72
         avg:                                   50.21
         max:                                  460.80
         95th percentile:                      106.75
         sum:                             50206986.58

Threads fairness:
    events (avg/stddev):           6666.6667/26.49
    execution time (avg/stddev):   334.7132/0.02
</code></pre><p>&#x573A;&#x666F;X</p>
<pre><code>SQL statistics:
    queries performed:
        read:                            0
        write:                           5301427
        other:                           10602854
        total:                           15904281
    transactions:                        5301427 (1766.79 per sec.)
    queries:                             15904281 (5300.38 per sec.)
    ignored errors:                      0      (0.00 per sec.)
    reconnects:                          0      (0.00 per sec.)

General statistics:
    total time:                          3000.5907s
    total number of events:              5301427

Latency (ms):
         min:                                    3.42
         avg:                                  554.63
         max:                                 6987.21
         95th percentile:                     1376.60
         sum:                           2940336486.66

Threads fairness:
    events (avg/stddev):           5409.6194/48.67
    execution time (avg/stddev):   3000.3434/0.12
</code></pre><p>&#x573A;&#x666F;3</p>
<pre><code>SQL statistics:
    queries performed:
        read:                            0
        write:                           1000000
        other:                           2000000
        total:                           3000000
    transactions:                        1000000 (2627.21 per sec.)
    queries:                             3000000 (7881.63 per sec.)
    ignored errors:                      0      (0.00 per sec.)
    reconnects:                          0      (0.00 per sec.)

General statistics:
    total time:                          380.6305s
    total number of events:              1000000

Latency (ms):
         min:                                    3.63
         avg:                                   57.08
         max:                                  623.84
         95th percentile:                      130.13
         sum:                             57084238.66

Threads fairness:
    events (avg/stddev):           6666.6667/26.37
    execution time (avg/stddev):   380.5616/0.02
</code></pre><h3 id="&#x5E76;&#x53D1;&#x7EBF;&#x7A0B;&#x6570;&#x5BF9;&#x6BD4;">&#x5E76;&#x53D1;&#x7EBF;&#x7A0B;&#x6570;&#x5BF9;&#x6BD4;</h3>
<p>&#x6D4B;&#x8BD5;&#x6761;&#x4EF6;&#xFF1A;&#x5B58;&#x91CF;&#x6570;&#x636E;0&#x3001;&#x589E;&#x91CF;100w&#x8BA2;&#x5355;</p>
<table>
<thead>
<tr>
<th>&#x5E76;&#x53D1;&#x7EBF;&#x7A0B;&#x6570;</th>
<th>TPS</th>
<th>QPS</th>
<th>mysql&#x6700;&#x5927;&#x8FDE;&#x63A5;&#x6570;</th>
</tr>
</thead>
<tbody>
<tr>
<td>100</td>
<td>1347</td>
<td>6739</td>
<td>151</td>
</tr>
<tr>
<td>1k</td>
<td>675</td>
<td>3377</td>
<td>1100</td>
</tr>
<tr>
<td>1w</td>
<td></td>
<td></td>
</tr>
</tbody>
</table>
<p>&#x5E76;&#x53D1;&#x7EBF;&#x7A0B;&#x6570;100</p>
<pre><code>sysbench --oltp_tables_count=1 --report-interval=10 --oltp-table-size=1000000  --mysql-user=root --mysql-password=504 --mysql-table-engine=innodb  --rand-init=on  --mysql-host=10.0.5.1 --mysql-port=33069 --mysql-db=test --events=1000000 --oltp_skip_trx=off --oltp_auto_inc=on --threads=100 --time=1200 --forced-shutdown=5 --debug /lua/order.lua run &gt;&gt; /lua/order-h.log

&#x5B58;&#x91CF;0
&#x589E;&#x91CF;100w
&#x6700;&#x5927;&#x8FDE;&#x63A5;&#x6570;151
&#x5E76;&#x53D1;&#x7EBF;&#x7A0B;&#x6570;100

SQL statistics:
    queries performed:
        read:                            1000000
        write:                           2000000
        other:                           2000000
        total:                           5000000
    transactions:                        1000000 (1347.83 per sec.)
    queries:                             5000000 (6739.16 per sec.)
    ignored errors:                      0      (0.00 per sec.)
    reconnects:                          0      (0.00 per sec.)

General statistics:
    total time:                          741.9304s
    total number of events:              1000000

Latency (ms):
         min:                                    5.02
         avg:                                   74.18
         max:                                  775.64
         95th percentile:                      193.38
         sum:                             74175679.43

Threads fairness:
    events (avg/stddev):           10000.0000/38.59
    execution time (avg/stddev):   741.7568/0.02
</code></pre><p>&#x5E76;&#x53D1;&#x7EBF;&#x7A0B;&#x6570;1000</p>
<pre><code>sysbench --oltp_tables_count=1 --report-interval=10 --oltp-table-size=1000000  --mysql-user=root --mysql-password=504 --mysql-table-engine=innodb  --rand-init=on  --mysql-host=10.0.5.1 --mysql-port=33069 --mysql-db=test --events=1000000 --oltp_skip_trx=off --oltp_auto_inc=on --threads=1000 --time=1200 --forced-shutdown=5 /lua/order.lua run &gt;&gt; /lua/order-thousand.log

&#x5B58;&#x91CF;0
&#x589E;&#x91CF;100w
&#x6700;&#x5927;&#x8FDE;&#x63A5;&#x6570;151
&#x5E76;&#x53D1;&#x7EBF;&#x7A0B;&#x6570;100

SQL statistics:
    queries performed:
        read:                            814146
        write:                           1628292
        other:                           1628292
        total:                           4070730
    transactions:                        814146 (675.59 per sec.)
    queries:                             4070730 (3377.96 per sec.)
    ignored errors:                      0      (0.00 per sec.)
    reconnects:                          0      (0.00 per sec.)

Number of unfinished transactions on forced shutdown: 1000

General statistics:
    total time:                          1205.0835s
    total number of events:              814146

Latency (ms):
         min:                                    6.17
         avg:                                 1368.32
         max:                                14568.00
         95th percentile:                     3511.19
         sum:                           1114015439.40

Threads fairness:
    events (avg/stddev):           815.1460/227.84
    execution time (avg/stddev):   1114.0154/92.47
</code></pre><h3 id="&#x6570;&#x91CF;&#x7EA7;&#x5BF9;&#x6BD4;">&#x6570;&#x91CF;&#x7EA7;&#x5BF9;&#x6BD4;</h3>
<p>&#x5B58;&#x91CF;&#xFF1A;&#x767E;&#x4E07;vs&#x5343;&#x4E07;</p>
<p>&#x589E;&#x91CF;&#xFF1A;1&#x767E;&#x4E07;</p>
<h3 id="&#x8BFB;&#x5199;&#x5206;&#x79BB;">&#x8BFB;&#x5199;&#x5206;&#x79BB;</h3>
<h3 id="&#x5206;&#x5E93;&#x5206;&#x8868;">&#x5206;&#x5E93;&#x5206;&#x8868;</h3>
<p>&#x5355;&#x8868; vs 10&#x5F20;&#x5206;&#x8868; vs 2&#x4E2A;&#x5206;&#x5E93;5&#x5F20;&#x5206;&#x8868;</p>
<footer class="page-footer"><span class="copyright">Copyright &#xA9; tgor.top 2019 all right reserved&#xFF0C;powered by Gitbook</span><span class="footer-modification">&#x8BE5;&#x6587;&#x4EF6;&#x4FEE;&#x8BA2;&#x65F6;&#x95F4;&#xFF1A;
2020-04-23 15:32:53
</span></footer>
<script>console.log("plugin-popup....");document.onclick = function(e){ e.target.tagName === "IMG" && window.open(e.target.src,e.target.src)}</script><style>img{cursor:pointer}</style>
                                
                                </section>
                            
    </div>
    <div class="search-results">
        <div class="has-results">
            
            <h1 class="search-results-title"><span class='search-results-count'></span> results matching "<span class='search-query'></span>"</h1>
            <ul class="search-results-list"></ul>
            
        </div>
        <div class="no-results">
            
            <h1 class="search-results-title">No results matching "<span class='search-query'></span>"</h1>
            
        </div>
    </div>
</div>

                        </div>
                    </div>
                
            </div>

            
                
                <a href="mysql索引及查询.html#查询语句设计准则" class="navigation navigation-prev " aria-label="Previous page: mysql查询语句设计准则">
                    <i class="fa fa-angle-left"></i>
                </a>
                
                
                <a href="mysql主从同步与读写分离.html" class="navigation navigation-next " aria-label="Next page: mysql主从同步与读写分离">
                    <i class="fa fa-angle-right"></i>
                </a>
                
            
        
    </div>

    <script>
        var gitbook = gitbook || [];
        gitbook.push(function() {
            gitbook.page.hasChanged({"page":{"title":"mysql性能测试","level":"1.3.6","depth":2,"next":{"title":"mysql主从同步与读写分离","level":"1.3.7","depth":2,"path":"Mysql/mysql主从同步与读写分离.md","ref":"Mysql/mysql主从同步与读写分离.md","articles":[]},"previous":{"title":"mysql查询语句设计准则","level":"1.3.5","depth":2,"anchor":"#查询语句设计准则","path":"Mysql/mysql索引及查询.md","ref":"Mysql/mysql索引及查询.md#查询语句设计准则","articles":[]},"dir":"ltr"},"config":{"plugins":["chapter-fold","splitter","tbfed-pagefooter","page-toc-button","-search","search-pro","popup","back-to-top-button","code","copy-code-button"],"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"tbfed-pagefooter":{"copyright":"Copyright &copy tgor.top 2019","modify_label":"该文件修订时间：","modify_format":"YYYY-MM-DD HH:mm:ss"},"chapter-fold":{},"splitter":{},"search-pro":{"cutWordLib":"nodejieba","defineWord":["Gitbook Use"]},"popup":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"code":{"copyButtons":true},"fontsettings":{"theme":"sepia","family":"serif","size":1},"highlight":{},"page-toc-button":{"maxTocDepth":2,"minTocSize":2},"back-to-top-button":{},"copy-code-button":{},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"theme":"default","author":"tgor","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"title":"tgor note","gitbook":"*","description":"tgor生活工作记录"},"file":{"path":"Mysql/mysql性能测试.md","mtime":"2020-04-23T07:32:53.361Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2020-04-29T08:43:24.127Z"},"basePath":"..","book":{"language":""}});
        });
    </script>
</div>

        
    <script src="../gitbook/gitbook.js"></script>
    <script src="../gitbook/theme.js"></script>
    
        
        <script src="../gitbook/gitbook-plugin-chapter-fold/chapter-fold.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-splitter/splitter.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-page-toc-button/plugin.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-search-pro/jquery.mark.min.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-search-pro/search.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-back-to-top-button/plugin.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-code/plugin.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-copy-code-button/toggle.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-lunr/lunr.min.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-lunr/search-lunr.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-sharing/buttons.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-fontsettings/fontsettings.js"></script>
        
    

    </body>
</html>

